<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<title>{{$title}}</title>
	<link rel="stylesheet" href="/css/style.css">
	<script src="/js/jquery-2.1.4.min.js"></script>
	<script src="/js/laydate.js"></script>
</head>
<style type="text/css">
	#weiguineir,.chuna,#chrye{
	}
	.prd{
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.push_button{
		background: #ededed;
		background-image: -webkit-linear-gradient(top, #ededed, #bab1ba);
		background-image: -moz-linear-gradient(top, #ededed, #bab1ba);
		background-image: -ms-linear-gradient(top, #ededed, #bab1ba);
		background-image: -o-linear-gradient(top, #ededed, #bab1ba);
		background-image: linear-gradient(to bottom, #ededed, #bab1ba);
		-webkit-border-radius: 15;
		-moz-border-radius: 15;
		border-radius: 15px;
		text-shadow: 0px 1px 0px #e1e2ed;
		-webkit-box-shadow: 3px 4px 0px 0px #899599;
		-moz-box-shadow: 3px 4px 0px 0px #899599;
		box-shadow: 3px 4px 0px 0px #899599;
		font-family: Arial;
		color: #3a8a9e;
		font-size: 16px;
		padding: 12px 30px 12px 30px;
		border: solid #d6bcd6 1px;
		text-decoration: none;
		margin: 15px;
	}
	.heading{
		margin: 5px;
	}
	.push_button:hover {
		color: #3a8a9e;
		background: #bab1ba;
		text-decoration: none;
	}
	.ha{
		width:100%;
	}
	/*.chryec,.dcontent{*/
	/*	display: none;*/
	/*}*/
</style>
<body style="background: #F2F2F2;">
<form action="/ninecheck/updateelsepost" method="post">
	{{ csrf_field() }}
	<input type="hidden" name="groupId" value="{{$groupId}}">
	<input type="hidden" name="comcheckgroupid" value="{{$comcheckgroup->id}}">
	<ul class="noaccordww">
		<?php $i=1; ?>
		@foreach ($data as $da)
			<li>
				<input type="hidden" name="id[{{$i}}]" value="{{$da->id}}" class="inputIDs">
				<div id="dcontent" class="dcontent">
					<?php $pictures = explode(',',$da->pictures);?>
					@if(!empty($pictures))
						<p style="display:none;" class="heading">上传文件列表：</p>
						<ul id="files" style="text-align:left;display:none ;">
						</ul>
					@endif
					<input class="chryec" style="margin: 16px 3%;" value="{{$da->content}}" type="text" name="content[{{$i}}]" placeholder="隐患描述">
					<table>
						<tbody>
						<tr class="ha">

							<td><div class="push_button" onclick="appendByCamera()">拍照</div></td>
							<td><div class="push_button" onclick="appendByGallery()">相册</div></td>
							<td><div name="picture[{{$i}}]" class="push_button" onclick="upload(this,{{$i}})">上 传</div>
							</td>
							@foreach($pictures as $pic)
								@if(!empty($pic))
									<img style="width: 400px;height: 400px" src="{{$pic}}" alt="">
								@endif
							@endforeach
						</tr>
						<input type="hidden" name="picture[{{$i}}]" id="img{{$i}}" value="" />
						<tr class="ha">
						</tr>
						</tbody>
					</table>
				</div>
			</li>
			<?php $i++; ?>
		@endforeach
	</ul>
	<input type="submit" class="qrtj dibuann" value="下一步">
</form>
<!-- 违规内容弹窗 -->
<div id="goodcover2"></div>
<div id="code22">
	<form id="form1" onsubmit="return false" action="##" method="get" class="goodtxt muc">
		<div class="pItem"
		>
			<p></p>
			<p></p>
			<p></p>
		</div>
		<!--<input onclick="sel()" type="submit" text=""  />-->
		<input id="shezhi" type="submit" text="" />

	</form>
</div>



<!--提交？-->
<script type="text/javascript">
	var checkid;
	var checkidde;

	$('#shezhi').click(function sel() {



		var xuanzhongde = $(this).parents("form").children('div').children('p').attr("data-check")
		console.log(xuanzhongde)
		// 提交
		var arr = [];
		var xuanzhong = [];
		for (var i=0;i<$("#form1 .pItem p").length;i++){
			if($("#form1 .pItem p").eq(i).attr("class") == "act"){
				var ids = $("#form1 .pItem p").eq(i).attr("data-id")
				var iue = $("#form1 .pItem p").eq(i).text()
				if(!check) {
					var check = $("#form1 .pItem p").eq(i).attr("data-check")
				}
				arr.push(ids)
				xuanzhong.push(iue)

			}
		}
		console.log(arr)
		$(".noaccordww").append("<input class='e"+check+"' name='negative["+check+"]' value ='"+arr.join(',')+",'  type='hidden' >");
		$('#code22').hide();
		$('#goodcover2').hide();
		// ajax 提交数据


//				显示数据

//alert(checkid)
//每个大类的id
//alert(checkidde)
//点击的他自己这个违规选项的元素
//alert(xuanzhong)
//选中的违规项的内容
		if(checkidde.children("h1.prd")!=""){
			checkidde.children("h1.prd").remove()}

		for (var i=0;i<xuanzhong.length;i++){
//	alert(checkidde.attr("class"))


			checkidde.siblings(".dcontent").children(".turae").append("<h1 class='weigner prd' data-id='"+1+"'>"+xuanzhong[i]+"</h1>")

		}
	})






	function play() {
		console.log();
		var cont=document.getElementById("ClickMe2");
		console.log('innerHtml cont= '+ cont.innerHTML);
	}
</script>



<!---->
<script>
	$(function() {
		$("#form1 .pItem").on("click","p",function(){
			if($(this).attr("class") == "act"){
				$(this).removeClass("act")
			}else{
				$(this).addClass("act")
			}
		});
		//alert($(window).height());
		$('.weigner').click(function() {
//	    	$(this).parents("div").children('h1').siblings().remove()
			checkid = $(this).parents("div").parents('li').children('.inputIDs').val();
//	    	alert(checkid)
			checkidde = $(this).parents("li").children('div').next();
			$.ajax({

				type: "GET",//方法类型weigner
				dataType: "json",//预期服务器返  回的数据类型
				url: "/check/getChecknegative/"+checkid ,//url
				data: $('#form1').serialize(),
				success: function (result) {
					$('#code22').center();
					$('#goodcover2').show();
					$('#code22').fadeIn();
					$("#form1 .pItem").find('p').remove()
					for(var i=0;i<result.length;i++){
						if(i==0){
							$("#form1 .pItem").append("<p class='act' data-check='"+checkid+"' data-id='"+result[i].id+"'>"+result[i].content+"</p>")
						}else{
							$("#form1 .pItem").append("<p data-check='"+checkid+"' data-id='"+result[i].id+"'>"+result[i].content+"</p>")
						}
					}
				},
				error : function() {
					alert("数据读取异常！");
				}
			});

		});
		$('#closebt2').click(function() {
			$('#code22').hide();
			$('#goodcover2').hide();
		});
		$('#goodcover2').click(function() {
			$('#code22').hide();
			$('#goodcover2').hide();
		});
		jQuery.fn.center = function(loaded) {
			var obj = this;
			body_width = parseInt($(window).width());
			body_height = parseInt($(window).height());
			block_width = parseInt(obj.width());
			block_height = parseInt(obj.height());

			left_position = parseInt((body_width / 2) - (block_width / 2) + $(window).scrollLeft());
			if (body_width < block_width) {
				left_position = 0 + $(window).scrollLeft();
			};

			top_position = parseInt((body_height / 2) - (block_height / 2) + $(window).scrollTop());
			if (body_height < block_height) {
				top_position = 0 + $(window).scrollTop();
			};

			if (!loaded) {

				obj.css({
					// 'position': 'absolute'
					'position': 'fixed'
				});
				obj.css({
					'top': ($(window).height() - $('#code22').height()) * 0.5,
					'left': left_position
				});
				$(window).bind('resize', function() {
					obj.center(!loaded);
				});
				$(window).bind('scroll', function() {
					obj.center(!loaded);
				});

			} else {
				obj.stop();
				obj.css({
					// 'position': 'absolute'
					'position': 'fixed'
				});
				obj.animate({
					'top': top_position
				}, 200, 'linear');
			}
		}

	})
</script>
<!---->



<script>
	var shanc;
	$(".drfa1").click(
			function raea(){
//			alert(123)
				$(this).addClass("xuanzhong").siblings("a").removeClass("xuanzhong")
				$(this).siblings("input.chryec-s").val(1)

				$(this).siblings("input.chryec").hide()
				$(this).parent().next("div").hide()
				$(this).siblings(".gieo").hide()
				$(this).parent().next("div").children(".chryec").hide()

				shanc = "e"+$(this).parent().siblings(".inputIDs").val()
//			alert(shanc)
				//清空
				$("."+shanc+"").remove()
				$(this).parent().next("div").children(".turae").remove()

			}
	)
	$(".drfa2").click(
			function raea(){
//			alert(123)
				$(this).addClass("xuanzhong").siblings("a").removeClass("xuanzhong")
				$(this).siblings("input.chryec-s").val(2)
				$(this).siblings("input.chryec").show()
				$(this).parent().next("div").show()
				$(this).siblings(".gieo").show()
				$(this).parent().next("div").children(".chryec").show()
			}
	)
	$(".drfa3").click(
			function raea(){
//			alert(123)
				$(this).addClass("xuanzhong").siblings("a").removeClass("xuanzhong")
				$(this).siblings("input.chryec-s").val(3)
				$(this).siblings("input.chryec").hide()
				$(this).parent().next("div").hide()
				$(this).siblings(".gieo").hide()
				$(this).parent().next("div").children(".chryec").hide()
//			清空
				$("."+shanc+"").remove()
				$(this).parent().next("div").children(".turae").remove()

			}
	)
</script>

<script type="text/javascript">
	var server="http://book.ccshe.com/upload/uploadimg";
	var files=[];
	// 上传文件
	function upload(a,b){

		if(files.length<=0){
			plus.nativeUI.alert("没有添加上传文件！");
			return;
		}

		var wt=plus.nativeUI.showWaiting();
		var task=plus.uploader.createUpload(server,
				{method:"POST"},
				function(t,status){ //上传完成
					var rsult=JSON.parse(t.responseText);

					if(status==200){
						var yu='img'+b;
						var td = a.parentNode;
						var tr = td.parentNode;
						var newImg = document.createElement("img");
						//document.getElementByname('img').value += rsult.data + ',';
						document.getElementById(yu).value += rsult.data + ',';
						newImg.src = rsult.data;

						tr.appendChild(newImg);

						wt.close();
					}else{
						outLine("上传失败："+status);
						wt.close();
					}
				}
		);
		task.addData("client","HelloH5+");
		task.addData("uid",getUid());
		for(var i=0;i<files.length;i++){
			var f=files[i];
			task.addFile(f.path,{key:f.name});
		}
		task.start();
		files=[];
	}
	// 拍照添加文件
	function appendByCamera(){
		plus.camera.getCamera().captureImage(function(p){
			appendFile(p);
		});
	}
	// 从相册添加文件
	function appendByGallery(){
		plus.gallery.pick(function(p){
			appendFile(p);
		});
	}
	// 添加文件
	var index=1;
	function appendFile(p){
		var fe=document.getElementById("files");
		var li=document.createElement("li");
		var n=p.substr(p.lastIndexOf('/')+1);
		li.innerText=n;
		fe.appendChild(li);
		files.push({name:"fileImg",path:p});
		index++;
		empty.style.display="none";
	}
	// 产生一个随机数
	function getUid(){
		return Math.floor(Math.random()*100000000+10000000).toString();
	}
</script>
</body>
</html>